package org.scboy.logger.service.imp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import org.scboy.coobi.sql.factory.EntityFactory;
import org.scboy.logger.dao.LoggerRequestLogDao;
import org.scboy.logger.service.LoggerRequestLogService;
import org.scboy.utils.entitys.coobi.Model;
import org.scboy.utils.entitys.coobi.Page;
import org.scboy.utils.enums.coobi.OrderType;

/**
 * 
 * 请求日志
 * @author 杨浩
 *
 */
@Service
public class LoggerRequestLogServiceImpl implements LoggerRequestLogService {
	
	@Autowired
	EntityFactory factory;
	
	 /**
	  * 分页查询请求日志。
	  * @param params 查询参数
	  * @return
	  */	
	@Override
	public Page page(Model params) {
		LoggerRequestLogDao dao=factory.getDao(LoggerRequestLogDao.class);
		params.orderBy("logTime",OrderType.DESC).addNrc("headData").addNrc("requestParams").addNrc("requestBody").addNrc("responseBody");
		return dao.page(params);
	}
    
   /**
	 * 获取请求日志详细信息。
	 * @param 查询条件
	 * @return
	 */
	@Override
	public Model get(Model params) {
		LoggerRequestLogDao dao=factory.getDao(LoggerRequestLogDao.class);
		return dao.get(params);
	}
}
